"""
将test_debug.yml 添加到数据库当中
"""
import os
import sys
import django
path=os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'ansible_ui.settings'
django.setup()
sys.path.append("../")
from public.models import *
from django.contrib.auth.models import User

pb, b = AnsiblePlaybooks.objects.get_or_create(playbook='loop.yml')
if b:  # 如果不存在
    print('创建测试 playbook')
    pb.nickName = 'loop'
    pb.playbook = 'loop.yml'
    pb.save()
else:
    print('测试 playbook 已存在')
